<!-- addVue.vue -->
<template>
  <div id="add">
    <h2>数据：{{$store.state.count}}</h2>
    <button @click="add">同步增加</button>
    <button @click="addAsync">异步2秒后增加</button>
  </div>
</template>

<script setup>
import { useStore } from "vuex";
const store = useStore();

function add() {
  store.dispatch("addAction");
}

function addAsync() {
  store.dispatch("addAsync", 2000);
}
</script>

<style scoped>
#add {
  background-color: yellow;
}
</style>
